<!DOCTYPE html>
<html>
<head>
	<title>pctx.html</title>
	<meta charset="utf-8"/>
	<script src="./bower_components/react/react.js"></script>
	<script src="./bower_components/react/react-dom.js"></script>
	<script src="./bower_components/babel/browser.js"></script>

	<style>
		

	</style>
</head>
<body>
	<div id='app'></div>

	<script type="text/babel">

		class Child extends React.Component {
			constructor() {
				super();
				this.state = {

				}
			}

			render() {
				return (
					<div>我是子组件的数据 => {this.props.setMsg}</div>
				)
			}
		}

		class Parent extends React.Component {
			constructor() {
				super();
				this.state = {
					msg: '我是父组件的数据'
				}
			}
			render() {
				return (
					<div>
						<div onClick={this.show.bind(this)}>我是父组件 => {this.state.msg}</div>
						<Child setMsg={this.state.msg} />
					</div>
				)
			}

			show() {
				this.setState({
					msg: '我改变了'
				})
			}
		}

		ReactDOM.render(<Parent />, app);
	</script>

</body>
</html> 